package edu.neu.cs6515.xml;

import java.util.LinkedList;
import java.util.List;

import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

/**
 * Complete turn, consisting of the current board state and the player actions 
 * {@code <turn > Board XMLTurnProxy.Player  XMLAdministrator XMLActions  </turn>}
 */
@XmlRootElement(name = "turn")
@NoArgsConstructor
public final class XMLTurnProxy {

    @Getter
    @Setter
    private Board board;

    @Getter
    @Setter
    private Player player;

    private XMLAdministrator administrator = new XMLAdministrator();

    private XMLActions actions = new XMLActions();

    /**
     * Complete turn, consisting of the current board state and the player
     * actions
     * 
     * @param board
     *            Board used for the turn
     * @param player
     *            Player executing the turn
     */
    public XMLTurnProxy(final Board board, final Player player) {
        this.board = board;
        this.player = player;
    }

    public XMLAdministrator getAdministrator() {
        return administrator;
    }

    public void setAdministrator(final XMLAdministrator administrator) {
        this.administrator = administrator;
    }

    public XMLActions getActions() {
        return actions;
    }

    public void setActions(final XMLActions actions) {
        this.actions = actions;
    }

    /**
     * bean class for a Player 
     * {
     * @code <player> Score Tile Tile ...  </player>
     * }
     */
    @AllArgsConstructor
    @NoArgsConstructor
    public static final class Player {
        @Getter
        @Setter
        private Score score;

        @Getter
        @Setter
        private List<Tile> tile = new LinkedList<Tile>();
    }
}
